\section{device.\+c File Reference}
\label{device_8c}\index{device.\+c@{device.\+c}}


Ether\+C\+AT device methods.  


\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
int \textbf{ ec\+\_\+device\+\_\+init} (\textbf{ ec\+\_\+device\+\_\+t} $\ast$device, \textbf{ ec\+\_\+master\+\_\+t} $\ast$master)
\begin{DoxyCompactList}\small\item\em Constructor. \end{DoxyCompactList}\item 
void \textbf{ ec\+\_\+device\+\_\+clear} (\textbf{ ec\+\_\+device\+\_\+t} $\ast$device)
\begin{DoxyCompactList}\small\item\em Destructor. \end{DoxyCompactList}\item 
void \textbf{ ec\+\_\+device\+\_\+attach} (\textbf{ ec\+\_\+device\+\_\+t} $\ast$device, struct net\+\_\+device $\ast$net\+\_\+dev, \textbf{ ec\+\_\+pollfunc\+\_\+t} poll, struct module $\ast$module)
\begin{DoxyCompactList}\small\item\em Associate with net\+\_\+device. \end{DoxyCompactList}\item 
void \textbf{ ec\+\_\+device\+\_\+detach} (\textbf{ ec\+\_\+device\+\_\+t} $\ast$device)
\begin{DoxyCompactList}\small\item\em Disconnect from net\+\_\+device. \end{DoxyCompactList}\item 
int \textbf{ ec\+\_\+device\+\_\+open} (\textbf{ ec\+\_\+device\+\_\+t} $\ast$device)
\begin{DoxyCompactList}\small\item\em Opens the Ether\+C\+AT device. \end{DoxyCompactList}\item 
int \textbf{ ec\+\_\+device\+\_\+close} (\textbf{ ec\+\_\+device\+\_\+t} $\ast$device)
\begin{DoxyCompactList}\small\item\em Stops the Ether\+C\+AT device. \end{DoxyCompactList}\item 
uint8\+\_\+t $\ast$ \textbf{ ec\+\_\+device\+\_\+tx\+\_\+data} (\textbf{ ec\+\_\+device\+\_\+t} $\ast$device)
\begin{DoxyCompactList}\small\item\em Returns a pointer to the device\textquotesingle{}s transmit memory. \end{DoxyCompactList}\item 
void \textbf{ ec\+\_\+device\+\_\+send} (\textbf{ ec\+\_\+device\+\_\+t} $\ast$device, size\+\_\+t size)
\begin{DoxyCompactList}\small\item\em Sends the content of the transmit socket buffer. \end{DoxyCompactList}\item 
void \textbf{ ec\+\_\+device\+\_\+clear\+\_\+stats} (\textbf{ ec\+\_\+device\+\_\+t} $\ast$device)
\begin{DoxyCompactList}\small\item\em Clears the frame statistics. \end{DoxyCompactList}\item 
void \textbf{ ec\+\_\+device\+\_\+poll} (\textbf{ ec\+\_\+device\+\_\+t} $\ast$device)
\begin{DoxyCompactList}\small\item\em Calls the poll function of the assigned net\+\_\+device. \end{DoxyCompactList}\item 
void \textbf{ ec\+\_\+device\+\_\+update\+\_\+stats} (\textbf{ ec\+\_\+device\+\_\+t} $\ast$device)
\begin{DoxyCompactList}\small\item\em Update device statistics. \end{DoxyCompactList}\item 
void \textbf{ ecdev\+\_\+withdraw} (\textbf{ ec\+\_\+device\+\_\+t} $\ast$device)
\begin{DoxyCompactList}\small\item\em Withdraws an Ether\+C\+AT device from the master. \end{DoxyCompactList}\item 
int \textbf{ ecdev\+\_\+open} (\textbf{ ec\+\_\+device\+\_\+t} $\ast$device)
\begin{DoxyCompactList}\small\item\em Opens the network device and makes the master enter I\+D\+LE phase. \end{DoxyCompactList}\item 
void \textbf{ ecdev\+\_\+close} (\textbf{ ec\+\_\+device\+\_\+t} $\ast$device)
\begin{DoxyCompactList}\small\item\em Makes the master leave I\+D\+LE phase and closes the network device. \end{DoxyCompactList}\item 
void \textbf{ ecdev\+\_\+receive} (\textbf{ ec\+\_\+device\+\_\+t} $\ast$device, const void $\ast$data, size\+\_\+t size)
\begin{DoxyCompactList}\small\item\em Accepts a received frame. \end{DoxyCompactList}\item 
void \textbf{ ecdev\+\_\+set\+\_\+link} (\textbf{ ec\+\_\+device\+\_\+t} $\ast$device, uint8\+\_\+t state)
\begin{DoxyCompactList}\small\item\em Sets a new link state. \end{DoxyCompactList}\item 
uint8\+\_\+t \textbf{ ecdev\+\_\+get\+\_\+link} (const \textbf{ ec\+\_\+device\+\_\+t} $\ast$device)
\begin{DoxyCompactList}\small\item\em Reads the link state. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Ether\+C\+AT device methods. 



\subsection{Function Documentation}
\mbox{\label{device_8c_a4984e3e354110c1f4694fd521491cc30}} 
\index{device.\+c@{device.\+c}!ec\+\_\+device\+\_\+init@{ec\+\_\+device\+\_\+init}}
\index{ec\+\_\+device\+\_\+init@{ec\+\_\+device\+\_\+init}!device.\+c@{device.\+c}}
\subsubsection{ec\+\_\+device\+\_\+init()}
{\footnotesize\ttfamily int ec\+\_\+device\+\_\+init (\begin{DoxyParamCaption}\item[{\textbf{ ec\+\_\+device\+\_\+t} $\ast$}]{device,  }\item[{\textbf{ ec\+\_\+master\+\_\+t} $\ast$}]{master }\end{DoxyParamCaption})}



Constructor. 

\begin{DoxyReturn}{Returns}
0 in case of success, else $<$ 0 
\end{DoxyReturn}

\begin{DoxyParams}{Parameters}
{\em device} & Ether\+C\+AT device \\
\hline
{\em master} & master owning the device \\
\hline
\end{DoxyParams}


Definition at line 63 of file device.\+c.

\mbox{\label{device_8c_ad42f994e302efd7c59fc64bfc84f6037}} 
\index{device.\+c@{device.\+c}!ec\+\_\+device\+\_\+clear@{ec\+\_\+device\+\_\+clear}}
\index{ec\+\_\+device\+\_\+clear@{ec\+\_\+device\+\_\+clear}!device.\+c@{device.\+c}}
\subsubsection{ec\+\_\+device\+\_\+clear()}
{\footnotesize\ttfamily void ec\+\_\+device\+\_\+clear (\begin{DoxyParamCaption}\item[{\textbf{ ec\+\_\+device\+\_\+t} $\ast$}]{device }\end{DoxyParamCaption})}



Destructor. 


\begin{DoxyParams}{Parameters}
{\em device} & Ether\+C\+AT device \\
\hline
\end{DoxyParams}


Definition at line 162 of file device.\+c.

\mbox{\label{device_8c_a20976f86443d49ebf67caf83d4c0e156}} 
\index{device.\+c@{device.\+c}!ec\+\_\+device\+\_\+attach@{ec\+\_\+device\+\_\+attach}}
\index{ec\+\_\+device\+\_\+attach@{ec\+\_\+device\+\_\+attach}!device.\+c@{device.\+c}}
\subsubsection{ec\+\_\+device\+\_\+attach()}
{\footnotesize\ttfamily void ec\+\_\+device\+\_\+attach (\begin{DoxyParamCaption}\item[{\textbf{ ec\+\_\+device\+\_\+t} $\ast$}]{device,  }\item[{struct net\+\_\+device $\ast$}]{net\+\_\+dev,  }\item[{\textbf{ ec\+\_\+pollfunc\+\_\+t}}]{poll,  }\item[{struct module $\ast$}]{module }\end{DoxyParamCaption})}



Associate with net\+\_\+device. 


\begin{DoxyParams}{Parameters}
{\em device} & Ether\+C\+AT device \\
\hline
{\em net\+\_\+dev} & net\+\_\+device structure \\
\hline
{\em poll} & pointer to device\textquotesingle{}s poll function \\
\hline
{\em module} & the device\textquotesingle{}s module \\
\hline
\end{DoxyParams}


Definition at line 182 of file device.\+c.

\mbox{\label{device_8c_a12e63c43b18c206ba32fdb2a3d668bb8}} 
\index{device.\+c@{device.\+c}!ec\+\_\+device\+\_\+detach@{ec\+\_\+device\+\_\+detach}}
\index{ec\+\_\+device\+\_\+detach@{ec\+\_\+device\+\_\+detach}!device.\+c@{device.\+c}}
\subsubsection{ec\+\_\+device\+\_\+detach()}
{\footnotesize\ttfamily void ec\+\_\+device\+\_\+detach (\begin{DoxyParamCaption}\item[{\textbf{ ec\+\_\+device\+\_\+t} $\ast$}]{device }\end{DoxyParamCaption})}



Disconnect from net\+\_\+device. 


\begin{DoxyParams}{Parameters}
{\em device} & Ether\+C\+AT device \\
\hline
\end{DoxyParams}


Definition at line 213 of file device.\+c.

\mbox{\label{device_8c_aec3d7ce9ab236b9626efefbc8c2ffd96}} 
\index{device.\+c@{device.\+c}!ec\+\_\+device\+\_\+open@{ec\+\_\+device\+\_\+open}}
\index{ec\+\_\+device\+\_\+open@{ec\+\_\+device\+\_\+open}!device.\+c@{device.\+c}}
\subsubsection{ec\+\_\+device\+\_\+open()}
{\footnotesize\ttfamily int ec\+\_\+device\+\_\+open (\begin{DoxyParamCaption}\item[{\textbf{ ec\+\_\+device\+\_\+t} $\ast$}]{device }\end{DoxyParamCaption})}



Opens the Ether\+C\+AT device. 

\begin{DoxyReturn}{Returns}
0 in case of success, else $<$ 0 
\end{DoxyReturn}

\begin{DoxyParams}{Parameters}
{\em device} & Ether\+C\+AT device \\
\hline
\end{DoxyParams}


Definition at line 242 of file device.\+c.

\mbox{\label{device_8c_a1d4eadd4b9da0e4298818434e1b78a9a}} 
\index{device.\+c@{device.\+c}!ec\+\_\+device\+\_\+close@{ec\+\_\+device\+\_\+close}}
\index{ec\+\_\+device\+\_\+close@{ec\+\_\+device\+\_\+close}!device.\+c@{device.\+c}}
\subsubsection{ec\+\_\+device\+\_\+close()}
{\footnotesize\ttfamily int ec\+\_\+device\+\_\+close (\begin{DoxyParamCaption}\item[{\textbf{ ec\+\_\+device\+\_\+t} $\ast$}]{device }\end{DoxyParamCaption})}



Stops the Ether\+C\+AT device. 

\begin{DoxyReturn}{Returns}
0 in case of success, else $<$ 0 
\end{DoxyReturn}

\begin{DoxyParams}{Parameters}
{\em device} & Ether\+C\+AT device \\
\hline
\end{DoxyParams}


Definition at line 279 of file device.\+c.

\mbox{\label{device_8c_ac301d857a14ce98a79ffb12a7757bd09}} 
\index{device.\+c@{device.\+c}!ec\+\_\+device\+\_\+tx\+\_\+data@{ec\+\_\+device\+\_\+tx\+\_\+data}}
\index{ec\+\_\+device\+\_\+tx\+\_\+data@{ec\+\_\+device\+\_\+tx\+\_\+data}!device.\+c@{device.\+c}}
\subsubsection{ec\+\_\+device\+\_\+tx\+\_\+data()}
{\footnotesize\ttfamily uint8\+\_\+t$\ast$ ec\+\_\+device\+\_\+tx\+\_\+data (\begin{DoxyParamCaption}\item[{\textbf{ ec\+\_\+device\+\_\+t} $\ast$}]{device }\end{DoxyParamCaption})}



Returns a pointer to the device\textquotesingle{}s transmit memory. 

\begin{DoxyReturn}{Returns}
pointer to the TX socket buffer 
\end{DoxyReturn}

\begin{DoxyParams}{Parameters}
{\em device} & Ether\+C\+AT device \\
\hline
\end{DoxyParams}


Definition at line 312 of file device.\+c.

\mbox{\label{device_8c_ad46f8a21db1dd635d52bbae01b3f467f}} 
\index{device.\+c@{device.\+c}!ec\+\_\+device\+\_\+send@{ec\+\_\+device\+\_\+send}}
\index{ec\+\_\+device\+\_\+send@{ec\+\_\+device\+\_\+send}!device.\+c@{device.\+c}}
\subsubsection{ec\+\_\+device\+\_\+send()}
{\footnotesize\ttfamily void ec\+\_\+device\+\_\+send (\begin{DoxyParamCaption}\item[{\textbf{ ec\+\_\+device\+\_\+t} $\ast$}]{device,  }\item[{size\+\_\+t}]{size }\end{DoxyParamCaption})}



Sends the content of the transmit socket buffer. 

Cuts the socket buffer content to the (now known) size, and calls the start\+\_\+xmit() function of the assigned net\+\_\+device. 
\begin{DoxyParams}{Parameters}
{\em device} & Ether\+C\+AT device \\
\hline
{\em size} & number of bytes to send \\
\hline
\end{DoxyParams}


Definition at line 331 of file device.\+c.

\mbox{\label{device_8c_ac74ba2bebd2ed2468ec5b7942555ae9d}} 
\index{device.\+c@{device.\+c}!ec\+\_\+device\+\_\+clear\+\_\+stats@{ec\+\_\+device\+\_\+clear\+\_\+stats}}
\index{ec\+\_\+device\+\_\+clear\+\_\+stats@{ec\+\_\+device\+\_\+clear\+\_\+stats}!device.\+c@{device.\+c}}
\subsubsection{ec\+\_\+device\+\_\+clear\+\_\+stats()}
{\footnotesize\ttfamily void ec\+\_\+device\+\_\+clear\+\_\+stats (\begin{DoxyParamCaption}\item[{\textbf{ ec\+\_\+device\+\_\+t} $\ast$}]{device }\end{DoxyParamCaption})}



Clears the frame statistics. 


\begin{DoxyParams}{Parameters}
{\em device} & Ether\+C\+AT device \\
\hline
\end{DoxyParams}


Definition at line 374 of file device.\+c.

\mbox{\label{device_8c_a6944619b6e1c0f85d5f7d124a0a71af2}} 
\index{device.\+c@{device.\+c}!ec\+\_\+device\+\_\+poll@{ec\+\_\+device\+\_\+poll}}
\index{ec\+\_\+device\+\_\+poll@{ec\+\_\+device\+\_\+poll}!device.\+c@{device.\+c}}
\subsubsection{ec\+\_\+device\+\_\+poll()}
{\footnotesize\ttfamily void ec\+\_\+device\+\_\+poll (\begin{DoxyParamCaption}\item[{\textbf{ ec\+\_\+device\+\_\+t} $\ast$}]{device }\end{DoxyParamCaption})}



Calls the poll function of the assigned net\+\_\+device. 

The master itself works without using interrupts. Therefore the processing of received data and status changes of the network device has to be done by the master calling the I\+SR \char`\"{}manually\char`\"{}. 
\begin{DoxyParams}{Parameters}
{\em device} & Ether\+C\+AT device \\
\hline
\end{DoxyParams}


Definition at line 478 of file device.\+c.

\mbox{\label{device_8c_a158275fbb94b82be5d551044f38981f4}} 
\index{device.\+c@{device.\+c}!ec\+\_\+device\+\_\+update\+\_\+stats@{ec\+\_\+device\+\_\+update\+\_\+stats}}
\index{ec\+\_\+device\+\_\+update\+\_\+stats@{ec\+\_\+device\+\_\+update\+\_\+stats}!device.\+c@{device.\+c}}
\subsubsection{ec\+\_\+device\+\_\+update\+\_\+stats()}
{\footnotesize\ttfamily void ec\+\_\+device\+\_\+update\+\_\+stats (\begin{DoxyParamCaption}\item[{\textbf{ ec\+\_\+device\+\_\+t} $\ast$}]{device }\end{DoxyParamCaption})}



Update device statistics. 


\begin{DoxyParams}{Parameters}
{\em device} & Ether\+C\+AT device \\
\hline
\end{DoxyParams}


Definition at line 496 of file device.\+c.

